#pragma once

#ifndef _TerrainPart_h_
#define _TerrainPart_h_

#include "HeightMap.h"
#include "Tree.h"
#include "../../Framework/DrawableGameComponent.h"
#include "../../Framework/Vertex.h"

namespace MyGame {

class TerrainPart : public DrawableGameComponent {
public:
    TerrainPart(Game* game);
    virtual ~TerrainPart(void);
    ID3DXMesh* GetMesh() const;
    void SetHeightMap(HeightMap* val);
    void SetVertices(vector<Vertex>* val);
    void SetWaterHeight(FLOAT val);
    void InitializeMesh(FLOAT offsetX, FLOAT offsetZ);
private:
    HeightMap* heightMap;
    vector<DWORD>* indices;
    ID3DXMesh* mesh;
    FLOAT offsetX;
    FLOAT offsetZ;
    vector<Vertex>* vertices;
    FLOAT waterHeight;
    void GenerateIndices();
    void GenerateVertices();
};

}

#endif
